package org.s3.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import org.s3.project.entity.Merchant;
import org.s3.project.mapper.MerchantMapper;
import org.s3.project.service.MerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cfx
 * @version 1.0
 * @Description
 * @date 2025/2/9 10:22
 */
@Service
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
    @Autowired
  private   MerchantMapper merchantMapper;
    //商家登录
    @Override
    public Merchant login(String name, String password) {
        return merchantMapper.login(name,password);
    }

    @Override
    public Merchant ShowStatus(long id) {
        return merchantMapper.ShowStatus(id);
    }

    //查询所有商家
    @Override
    public List<Merchant> selectMerchants() {
        return merchantMapper.selectMerchants();
    }
    //登录的时候查询一下他是否申请过 ,为申请过就跳转申请页面
    @Override
    public Merchant ShowoPening_status(long id) {
        return merchantMapper.ShowoPening_status(id);
    }
    //查询所有商家
    @Override
    public List<Merchant> selectMerchant() {
        return merchantMapper.selectMerchant();
    }


    @Override
    public Merchant selectMerchantById(int id) {
        return merchantMapper.selectById(id);
    }
    /**
     * 模糊查询商家
     * @param name 商家名称
     * @param create_time 创建时间
     * @param create_timeOne 创建时间
     * @return 商家列表
     */
    @Override
    public List<Merchant> selectMerchantCheckLike(@Param("name") String name, @Param("create_time")String create_time, @Param("create_timeOne")String create_timeOne) {
        return merchantMapper.selectMerchantCheckLike(name,create_time,create_timeOne);
    }
    /**
     * 更新商家状态
     * @param id 商家id
     * @param status 商家状态
     * @return 更新结果
     */
    @Override
    public int updateMerchantStatus(@Param("id") int id, @Param("status")int status) {
        return merchantMapper.updateMerchantStatus(id,status);
    }

    @Override
    public int updateMerchantStatusIds(int[] ids, int status) {
        return merchantMapper.updateMerchantStatusIds(ids,status);
    }
    //查询商家商品数量
    @Override
    public int selectMerchantProductCount(int merchant_id) {
        return merchantMapper.selectMerchantProductCount(merchant_id);
    }

    @Override
    public int selectMerchantMonthSales(int merchant_id) {
        return merchantMapper.selectMerchantMonthSales(merchant_id);
    }

    @Override
    public int updateMerchant(Merchant merchant) {
        return merchantMapper.updateMerchant(merchant);
    }
    @Override
    public int updateMerchantStatusIds(int[] ids, int status) {
        return merchantMapper.updateMerchantStatusIds(ids,status);
    }
    //查询商家商品数量
    @Override
    public int selectMerchantProductCount(int merchant_id) {
        return merchantMapper.selectMerchantProductCount(merchant_id);
    }

    @Override
    public int selectMerchantMonthSales(int merchant_id) {
        return merchantMapper.selectMerchantMonthSales(merchant_id);
    }


}
